#include "StdAfx.h"
#include "PlusTestCase.h"
#include "SudaFileOperation.h"

CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CPlusTestCase, CPlusTestCase::GetSuiteName());

CPlusTestCase::CPlusTestCase()
{

}

CPlusTestCase::~CPlusTestCase()
{
}

void CPlusTestCase::testAdd()
{
	CPPUNIT_ASSERT(1);
}
void CPlusTestCase::TestFileReader()
{
	SudaFileOperation file;
	CStringArray strArray;
	file.ReadFileByRowEx(CString(L"./TestFile/FileOpen.txt"),strArray);
	CPPUNIT_ASSERT_EQUAL(CString(L"123"),strArray.GetAt(0));
}
void CPlusTestCase::TestFileWriter()
{
	SudaFileOperation file;
	CStringArray strArray;
	strArray.Add(CString(L"Tomcat"));
	strArray.Add(CString(L"Jerry"));
	int result = file.WriteFileByRow(CString(L"./TestFile/FileSave.txt"),strArray);
	CPPUNIT_ASSERT_EQUAL( (int)file.FILE_READ_SUCCESS,result);
}
std::string CPlusTestCase::GetSuiteName()
{
	return "FileOperationTest";
}

CppUnit::Test* CPlusTestCase::GetSuite()
{
	CppUnit::TestFactoryRegistry& reg = CppUnit::TestFactoryRegistry::getRegistry (CPlusTestCase::GetSuiteName());
                 return reg.makeTest();
}

